﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ModelLayer;
using DataLayer;
using System.Configuration;
using DTO;

namespace BusinessLayer.Logic.UserLogic
{
    public class ModelloLogic
    {

        public int getCurrentIdModello()
        {

            return Int32.Parse(ConfigurationManager.AppSettings["idModello"]);

        }

        public Modello getModelloConRisposteUtente(DTOUtente dto)
        {

            Modello modelloCorrente;
            // Carico il Modello richiesto e relative Competenze
            using (ModelliHelper mh = new ModelliHelper())
            {
                modelloCorrente = mh.getModello(getCurrentIdModello(), dto.Username);
            }

            return modelloCorrente;

        }
        public Dictionary<String, String> getDictionary(String lang)
        {

            Dictionary<String,String> dict;
            if ((dict = DictionaryManager.Instance.getLanguage(lang) )!= null)
                return dict;
            using (ModelliHelper mh = new ModelliHelper())
            {
                dict = mh.getDictionary(lang);
                DictionaryManager.Instance.addDictionary(dict, lang);
            }
            return dict;
            
        }

    }
}
